
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>火石镜头后台管理</title>
    <link rel="shortcut icon" href="../img/icon.png">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Free HTML5 Template by FreeHTML5.co" />
    <meta name="keywords" content="free html5, free template, free bootstrap, html5, css3, mobile first, responsive" />

    <!-- Facebook and Twitter integration -->
    <meta property="og:title" content=""/>
    <meta property="og:image" content=""/>
    <meta property="og:url" content=""/>
    <meta property="og:site_name" content=""/>
    <meta property="og:description" content=""/>
    <meta name="twitter:title" content="" />
    <meta name="twitter:image" content="" />
    <meta name="twitter:url" content="" />
    <meta name="twitter:card" content="" />
    <script>
        <!-- 解决登录页面嵌套问题 -->
        if (window != top){
            top.location.href = location.href;
        }
    </script>

    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
    <link rel="shortcut icon" href="favicon.ico">

    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,300' rel='stylesheet' type='text/css'>

    <link rel="stylesheet" href="../login/css/bootstrap.min.css">
    <link rel="stylesheet" href="../login/css/animate.css">
    <link rel="stylesheet" href="../login/css/style.css">

    <!-- Modernizr JS -->
    <script src="../login/js/modernizr-2.6.2.min.js"></script>
    <!-- FOR IE9 below -->
    <!--[if lt IE 9]>
    <script src="../login/js/respond.min.js"></script>
    <![endif]-->

</head>
<body class="style-3">

<div class="container">
    <div class="row">

    </div>

    <div class="row" style="margin: auto">
        <div class="col-md-4 col-md-offset-4">

            <!-- Start Sign In Form -->
            <form  id="login" action="#" class="fh5co-form animate-box" data-animate-effect="fadeIn">
                <h2>火石镜头后台管理</h2>
                <div id="errorMsg" style="display: none" class="alert alert-danger display-hide">
                    <button class="close" data-close="alert"></button>
                    <span></span>
                </div>
                <div class="form-group">
                    <label for="username" class="sr-only">Username</label>
                    <input type="text" class="form-control" name="username" id="username" placeholder="Username" autocomplete="off">
                </div>
                <div class="form-group">
                    <label for="password" class="sr-only">Password</label>
                    <input type="password" class="form-control" name="password" id="password" placeholder="Password" autocomplete="off">
                </div>

                <div class="form-group">
                    <input type="button" id="sub" value="登陆" class="btn btn-primary">
                </div>
            </form>
            <!-- END Sign In Form -->

        </div>
    </div>
    <div class="row" style="padding-top: 60px; clear: both;">

    </div>
    <div class="row" style="padding-top: 60px; clear: both;">
        <div class="col-md-12 text-center"><p><small> 2018&copy;By 环爱网络科技(上海)有限公司</small></p></div>
    </div>
</div>

<!-- jQuery -->
<script src="../login/js/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="../login/js/bootstrap.min.js"></script>
<!-- Placeholder -->
<script src="../login/js/jquery.placeholder.min.js"></script>
<!-- Waypoints -->
<script src="../login/js/jquery.waypoints.min.js"></script>
<!-- Main JS -->
<script src="../login/js/main.js"></script>

<script>
    $("input").focus(function(){
        $("#errorMsg").hide();
    })
    $("#sub").click(function(){
//        var json=$("#login").serialize();
        var f=true;
        if($.trim($("#username").val())=='' || $.trim($("#password").val())==''){
            $("#errorMsg span").html("请输入用户名或密码");
            $("#errorMsg").removeClass("display-hide");
            $("#errorMsg").show();
            f=false;
            return false;
        }
        //${request.getContextPath()}
        if(f){
            $.ajax({
                url:"/loginController/login",
                type:"POST",
                data:$("#login").serialize(),
                dataType:"json",
                success:function(data){
                    if(data.ret==0||data.ret=='0'){
                        window.location.href="/page/welcome";
                    }else{
                        $("#errorMsg span").html(data.msg);
                        $("#errorMsg").show();
                        return false;
                    }
                },
                error:function () {
                    layer.alert('系统错误', {icon: 5});
                }
            })
        }

    })
</script>
</body>
</html>

